//	ID : pallab81
// 	PROG : NY10E
// 	LANG : C++
// 	2011-06-26-18.24.17 Sunday
//
// 	"I have not failed, I have just found 10000 ways that won't work.
//


#include <iostream>
#include <algorithm>
#include <vector>
#include <sstream>
#include <fstream>
#include <string>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <functional>
#include <bitset>
#include <numeric>

#include <cstdio>
#include <cmath>
#include <cstring>
#include <climits>
#include <cstring>

using namespace std;

#define  CI( x ) scanf( "%d", &x )

#define VI vector<int>
#define VVI vector<VI >
#define VS vector<string>
#define VC vector<char>
#define VVC vector<VC >
#define VB vector<bool>
#define VVB vector<VB >
#define PAIR pair<int,int>
#define VP vector<PAIR >
#define fo(i,st,ed) for(int i = st; i < ed ; ++i)
#define foE(i,st,ed) for(int i = st; i <= ed ; ++i)
#define foit(i, x) for (typeof((x).begin()) i = (x).begin(); i != (x).end(); i++)
#define bip system("pause")
#define mk make_pair
#define f first
#define s second
#define pb push_back
#define SZ(X) (int)(X).size()
#define LN(X) (int)(X).length()
#define Int long long
#define IO ifstream cin(".in") ; ofstream cout(".out");

const int length = 70 ;
Int cache[ 70 ] [ 15 ] ;// [ current length of number , starting digit ]

inline void proc(int case_number,int to_length){
    memset( cache, 0, sizeof(cache) );

    foE(digit,0,9){
        cache[ 1 ][ digit ] = 1;
    }

    foE(len,2,to_length){
        foE(digit,0,9){
            foE(_digit,0,digit){
                cache[ len ][ digit ]+= cache[ len-1 ][ _digit ];
            }
        }
    }
    long long retval = accumulate( cache[to_length], cache[to_length]+10, 0LL);
    printf("%d %lld\n",case_number,retval);
}
int main(){
    int cases,case_number,to_length;
    scanf("%d",&cases);
    fo(i,0,cases){
        scanf("%d %d",&case_number,&to_length);
        proc(case_number,to_length);
    }

return 0;
}

